<%--
  Created by IntelliJ IDEA.
  User: ZhuChunXiao
  Date: 2017/7/25
  Time: 10:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page import="java.util.Date" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
  String _id=request.getParameter("_");
  request.setAttribute("now",new Date());
  String jsessionid = session.getId();
%>
<form id="form_task_uploadfile" class="panel-body form-horizontal form-padding">
  <div class="form-group">
    <label class="col-md-2 control-label">相关附件<i class="fa fa-asterisk txt-color-red"></i></label>
    <div class="col-md-6">
      <input name="uploadify" id="filename" style="display: none"  placeholder="" type="file" >
      <input name="fileId" id="fileId" style="display: none" value="${fileId}">
    </div>
    <div class="col-md-2">
      <a class="btn btn-warning" onclick="fn_task_upload_file1()" href="javascript:void(0);"><i class="fa fa-upload"></i> 保存相关附件 </a>
    </div>
  </div>
</form>

<script>
  // 附件上传
  inputLoad({
    objId:"filename",
    entityName:"fileIds",
    sourceId:"fileId",
    jsessionid:"<%=jsessionid%>"
  });

  function fn_task_upload_file1() {
    $.ajax({
      url: '<%=path%>/com/task/uploadfile',
      type: "POST",
      cache: false,
      dataType: 'json',
      data: {
        keyId: $("#form_task_input #keyId").val(),
        fileIds: $("#form_task_uploadfile #fileIds").val()
      },
      success: function(data) {
        __toastr(data);
      },
      error:function() {
        __toastr_error('上传数据出错');
      }
    });
  }

</script>